home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / clip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-17  |  1.8 KB  |  75 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: clip.h,v 1.1 89/03/17 08:20:52 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/clip.h,v $
  10. */
  11. static char    h_clip_[] = "$Source: /m1/mgr.new/src/RCS/clip.h,v $$Revision: 1.1 $";
  12.  
  13. /* macros for determining clip rectangle for background updates */
  14.  
  15. #ifndef Max
  16. #define Max(x,y)        ((x)>(y)?(x):(y))
  17. #endif
  18. #ifndef Min
  19. #define Min(x,y)        ((x)>(y)?(y):(x))
  20. #endif
  21.  
  22. typedef struct {        /* clipping rectangle */
  23.   int x1,y1,x2,y2;
  24.   } rect;
  25.  
  26. #ifdef DEBUG
  27. #define SHOW_CLIP() \
  28.     bit_blit(screen,W(x0)+SUM_BDR+clip.x1,W(y0)+SUM_BDR+clip.y1, \
  29.     clip.x2-clip.x1,clip.y2-clip.y1, \
  30.     BIT_NOT(BIT_DST),NULL,0,0);
  31. #define SHOW() \
  32.     if (debug && index(debug_level,'c'))  \
  33.         { SHOW_CLIP();getchar();SHOW_CLIP(); }
  34. #else
  35. #define SHOW()
  36. #endif
  37.  
  38. #define Do_clip() \
  39.     (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE))
  40.  
  41. #define Set_all() { \
  42.     clip.x1 = 0, clip.y1=0; \
  43.     clip.x2 = BIT_WIDE(W(border)); \
  44.     clip.y2 = BIT_HIGH(W(border)); \
  45.     SHOW(); \
  46.         }
  47.  
  48. #define Set_clipall() { \
  49.     clip.x2 = 0, clip.y2=0; \
  50.     clip.x1 = BIT_WIDE(W(border)); \
  51.     clip.y1 = BIT_HIGH(W(border)); \
  52.         }
  53.  
  54. #define Set_clip(X1,Y1,X2,Y2) { \
  55.     clip.x1 = Min(clip.x1,X1); \
  56.     clip.y1 = Min(clip.y1,Y1); \
  57.     clip.x2 = Max(clip.x2,X2); \
  58.     clip.y2 = Max(clip.y2,Y2); \
  59.     SHOW(); \
  60.     }
  61.  
  62. #define Set_cliplow(X1,Y1) { \
  63.     clip.x1 = Min(clip.x1,X1); \
  64.     clip.y1 = Min(clip.y1,Y1); \
  65.     SHOW(); \
  66.     }
  67.  
  68. #define Set_cliphigh(X2,Y2) { \
  69.     clip.x2 = Max(clip.x2,X2); \
  70.     clip.y2 = Max(clip.y2,Y2); \
  71.     SHOW(); \
  72.     }
  73.  
  74. extern rect clip;
  75.